﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate.Cfg;
using NHibernate.Dialect;
using NHibernate;
using BuildHelper.Domain;
using nEnv = NHibernate.Cfg.Environment;

namespace BuildHelper
{
    public static class HibernateTools
    {
        public static void ConfigureHibernate()
        {
            Configuration nHibernateConfiguration = new Configuration();
            nHibernateConfiguration.SetProperty(nEnv.Dialect, typeof(MsSqlCeDialect).AssemblyQualifiedName);
            nHibernateConfiguration.SetProperty(nEnv.ConnectionString, ProgNetComponents.Data.SqlCe.SqlCeDataManager.GlobalConnectionString);
            nHibernateConfiguration.SetProperty(nEnv.FormatSql, "true");
            nHibernateConfiguration.AddAssembly(System.Reflection.Assembly.GetCallingAssembly());

            DomainHelper.SessionFactory = nHibernateConfiguration.BuildSessionFactory();
        }
    }
   
}
